<?php
declare (strict_types = 1);

namespace app\admin\validate;

use think\Validate;

class MarketSmCopywritingTasks extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'id' => 'require',
        'crypto_news_id' => 'require|integer',
        'channel_id' => 'require|integer',
        'language_id' => 'require|integer',
        'account_group_id' => 'require|integer',
        'mining_machine' => 'max:4096',
        'cue_word' => 'max:65535',
        'creator' => 'integer',
        'create_time' => 'date',
        'imgs' => 'array'
    ];

    // 错误消息
    protected $message = [
        'crypto_news_id.require' => '新闻Id不能为空',
        'crypto_news_id.integer' => '新闻Id必须为整数',
        'channel_id.require' => '渠道Id不能为空',
        'channel_id.integer' => '渠道Id必须为整数',
        'language_id.require' => '语言Id不能为空',
        'language_id.integer' => '语言Id必须为整数',
        'account_group_id.require' => '分组Id不能为空',
        'account_group_id.integer' => '分组Id必须为整数',
        'mining_machine.require' => '服务器不能为空',
        'mining_machine.max' => '服务器长度不能超过4096个字符',
        'cue_word.max' => '提示词长度不能超过65535个字符',
        'creator.integer' => '创建人必须为整数',
        'create_time.date' => '创建时间格式不正确',
    ];

    // 场景设置
    protected $scene = [
        'batchGeneration' => ['crypto_news_id','channel_id','language_id','account_group_id','mining_machine','cue_word','imgs'],
        'read' => ['id']
    ];
}
